/**
 * 用户相关
 */
export interface User {
  username: string;
  email: string;
}
export interface CreateUserPayload {
  username: string;
  password: string;
}

export interface LoginPayload {
  username: string;
  password: string;
}

export interface LoginRes {
  access_token: string;
}

export interface CurrentUserRes {
  username: string;
  email: string;
}

/**
 * 应用相关
 */
export type ApplicationType = "vanilla" | "react" | "vue";

export interface ApplicationData {
  type: ApplicationType;
  appId: string;
  name: string;
  bugs: number;
  transactions: number;
  data: {
    date: string;
    resting: number;
  }[];
  createdAt: Date;
}
/**
 * 应用列表
 */
export interface ApplicationListRes {
  data: { applications: ApplicationData[] };
}

/**
 * 创建应用
 */
export interface CreateApplicationPayload {
  name: string;
  type: ApplicationType;
}

/**
 * Page页面相关
 */
export interface Page {
  id: number;
  pageId: string;
  emoji: string;
  title: string;
  createdAt: string;
}
/**
 * 创建页面
 */
export interface CreatePagePayload {
  emoji: string;
  title: string;
}

/**
 * 更新页面
 */
export interface UpdatePagePayload {
  pageId: string;
  title: string;
}

/**
 * 页面列表
 */
export interface PageListRes {
  data: {
    pages: Page[];
    count: number;
  };
}

/**
 * 页面关系图谱
 */
export interface WithLinksPage extends Page {
  links: string[];
}
export interface PageGraphRes {
  data: WithLinksPage[];
}
